package com.xiaotu.test.github.pageprocessor;

import com.xiaotu.spider.APageProcessor;

import net.sf.json.JSONObject;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Request;

/**
 * @类名 GithubRepoPageProcessor
 * @日期 2017年2月7日
 * @作者 高海军
 * @功能
 */
public class GithubRepoPageProcessor extends APageProcessor
{
	/*
	 * (non-Javadoc)
	 * @see com.xiaotu.spider.interfaces.APageProcessor#doProcess(us.codecraft.
	 * webmagic.Page, com.xiaotu.common.model.JobLogModel)
	 */
	@Override
	public void process(Page page)
	{
//		page.addTargetRequests(page.getHtml().links()
//				.regex("(https://github\\.com/\\w+/\\w+)").all());
//		page.putField("author", page.getUrl()
//				.regex("https://github\\.com/(\\w+)/.*").toString());
//		page.putField("name", page.getHtml()
//				.xpath("//h1[@class='public']/strong/a/text()").toString());
		// if (page.getResultItems().get("name") == null)
		// {
		// // skip this page
		// page.setSkip(true);
		// }
//		page.putField("readme",
//				page.getHtml().xpath("//div[@id='readme']/tidyText()"));
	}
	
	/* (non-Javadoc)
	 * @see com.xiaotu.spider.APageProcessor#getStartRequest(net.sf.json.JSONObject)
	 */
	@Override
	protected Request getStartRequest(JSONObject target)
	{
		// TODO Auto-generated method stub
		return null;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.xiaotu.spider.interfaces.APageProcessor#setSiteRequest()
	 */
	@Override
	protected void setSiteRequest()
	{
		// TODO Auto-generated method stub
		
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.xiaotu.spider.APageProcessor#getSpiderType()
	 */
	@Override
	protected String getSpiderType()
	{
		// TODO Auto-generated method stub
		return null;
	}
	
	/*
	 * (non-Javadoc)
	 * @see
	 * com.xiaotu.spider.APageProcessor#getPageDataType(us.codecraft.webmagic.
	 * Page)
	 */
	@Override
	public String getPageDataType(Page page)
	{
		// TODO Auto-generated method stub
		return null;
	}
}
